#pragma once

#include "Object.h"

/**
	* Class for Game Object Ladder - Hong Tai
	*
	* Handles position and how many steps there is
	* Renders the ladder as a whole
	* Line - box collision check
*/
class Ladder{
public:
	enum LADDERTYPE { MOVING, STATIC };
private:
	int numberOfSteps;
	Object *ladder;

	float minY, maxY;

	int half, counter;

	LADDERTYPE type;
public:
	Ladder(void);
	~Ladder(void);
	
	/**
		* Function to initialize the ladder position and height
		*
		* Initialize the length of the line on the Y axis for the first step to the maxium height of the last step for easier collision check.
		* @param Position of the ladder
		* @param The number of steps
		* @param What kind of ladder is it. A moving or static ladder
	*/
	void InitLadderHeight(Vector3D position, int numberOfSteps, LADDERTYPE type);

	/**
		* Function to render the entire ladder
	*/
	void DrawLadder(void);

	/**
		* Function to move half of the ladder up and down.
		*
		* @param Elapsed time for frame independent movement. Needed because codes for movement is inside
	*/
	void LetLadderMove(float elapsed);
	
	/**
		* Function for collision check of ladder to object
		*
		* Only needs to check for the first step because the line extends to the last step. No for loop needed.
		* @param The bounding box of object that is checking for ladder
		* @return True if collided else false
	*/
	bool CollisionWithLadder(BoundingBox &theBox);

	/**
		* Function for collision check against top of ladder (Special occasion)
		*
		* Only needs to check for the first step because the line extends to the last step. No for loop needed.
		* @param The bounding box of object that is checking for ladder
		* @return True if collided else false
	*/
	bool CollisionWithTopStep(BoundingBox &theBox);
};